<?php if(!empty($list_topic)):?>
<div id="topic-container">
<?php foreach($list_topic as $k=>$v):?>
<div class="topic sd1">
<table style="width: 100%;">
	<tr class="even">
		<td rowspan="2" width="65">
    		<a href="<?php echo site_url('c=member&m=index&id='.$v->poster_id);?>">
    			<img class="avator1" src="http://www.gravatar.com/avatar/<?php echo md5($v->posteremail);?>?s=60&d=&r=X"/>
    		</a>
		</td>
		<td colspan="5">
    		<?php if(!empty($v->rposter_id)):?>
    		<a href="<?php echo site_url('c=member&m=index&id='.$v->rposter_id);?>">
				<img src="http://www.gravatar.com/avatar/<?php echo md5($v->rposteremail);?>?s=30&d=&r=X"/>
			</a>
    		<?php endif;?>
    		<?php if(!empty($v->r_music_id)):?>
			<a class="c2" onclick="playpop(<?php echo $v->r_music_id;?>);" href="javascript:void(0);">#<?php echo $v->r_music_name;?>#</a>
			@
			<a class="c2" onclick="playpop(<?php echo $v->music_id;?>);" href="javascript:void(0);">#<?php echo $v->music_name;?>#</a>
			<?php else:?>
			<a class="c2" onclick="playpop(<?php echo $v->music_id;?>);" href="javascript:void(0);">#<?php echo $v->music_name;?>#</a>
			<?php endif;?>
			<?php echo $v->cont;?>
		</td>
	</tr>
	<tr>
		<td class="fs2">
		    <span class="c4"><?php echo $v->postername;?></span>
		    <span class="c3"><?php echo mydate($v->atime);?></span>
		</td>
		<td width="40">
			<a class="btn-play" music_id="<?php echo $v->music_id;?>" href="javascript:void(0);">播放</a>
		</td>
		<td width="40">
    		<a class="btn-ajax-confirm" msg="Sure 不   ？"
    			href="<?php echo site_url('c=recmd&m=del&id='.$v->recmd_id);?>">删除</a>
    	</td>
		<td width="70">
			<a class="btn-ajax-load btn-comment" alc="#panel-comment-<?php echo $v->id;?>" 
				befordo="befor_comment_do"
				href="<?php echo site_url('c=topic&m=reply&tid='.$v->id);?>">评论<span class="c3"><?php echo $v->count_reply;?></span></a>
		</td>
		<td width="70">
					<a class="wm-ajax"
                    	wmtitle="转发"
                    	wmw="520"
                    	wmh="200"
						href="<?php echo site_url('c=topic&m=forward&rid='.$v->id);?>">
							转发<span class="c3"><?php echo $v->count_forward;?></span>						
						</a>
		</td>
	</tr>
</table>
<div id="panel-comment-<?php echo $v->id;?>" class="panel-comment"></div>
</div>
<?php endforeach;;?>


<script>

function befor_comment_do($elt){
	$elt.parents('.topic').siblings().find('..panel-comment .panel1').remove();
	if($elt.parents('.topic').find('..panel-comment .panel1').size()>0){
		$elt.parents('.topic').find('..panel-comment .panel1').remove();
		return false;
	}else{
		return true;
	}
}

function dig_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.empty().html(msg.data.count);
		return false;
	}
	
	return true;
	
}

function favo_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.find('.favo-count').empty().html(msg.data.count_favo);
		$elt.find('.favo-title').empty().html(msg.msg);
		return false;
	}
	
	return true;
}

//收藏后操作
function favo_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.find('.favo-count').empty().html(msg.data.count_favo);
		$elt.find('.favo-title').empty().html(msg.msg);
		return false;
	}
	
	return true;
}

//喜欢后操作
function dig_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.find('.dig-count').text(msg.data.count);
		return false;
	}
	
	return true;
}



$(function(){
	$('.btn-play').click(function(){
		$('#music-media').remove();
		if($('#music-media') && $(this).attr('play') == '1'){
			$(this).attr('play','0');
			$(this).text('播放');
			return;
		}
		
		var music_id = $(this).attr('music_id');
		$('#topic-container').find('.btn-play').text('播放');
		
		$(this).text('暂停');
		$(this).attr('play','1');

		var media = '';
		media += '<div id="music-media"><embed height="33" width="257"';
		media += ' src="http://img.xiami.com/widget/0_'+music_id+'_/singlePlayer.swf"';
		media += ' menu="false" wmode="transparent" quality="high" ';
		media += ' pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"';
		media += ' type="application/x-shockwave-flash"></embed></div>';
		$('body').append(media);
	});	
});


</script>

</div>
<?php else:?>
暂无数据！
<?php endif;?>

